package com.rabbiter.pm.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class SpringBootWebMvcConfigurer implements WebMvcConfigurer {
    public void addResourceHandlers(ResourceHandlerRegistry registry){
//获取文件的真实路径
        String path = System.getProperty("user.dir")+"\\src\\main\\resources\\public\\upload\\";
        //       /images/**是对应resource下工程目录
        registry.addResourceHandler("/public/upload/**").addResourceLocations("file:"+path);
    }

}

